<?php
/**
 * The template for displaying all single posts.
 *
 * @package EverBox
 */


get_header();
the_post();
$category = get_the_category();
?>
<div id="primary" class="left-column" >
                
    <div class="web-address">
        <i class="icon list-addres"></i>
        您的位置:
        <a class="a-link" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
         &gt;
         <a style="color: #999;" href="<?php the_permalink(); ?>"><?php 
            echo '<a class="a-link" href="'.esc_url(get_category_link( $category[0]->term_id )).'" title="' . 
                                esc_attr( sprintf( __( "View all posts in %s", 'everbox' ), $category[0]->name ) ) .
                                '">'.esc_html($category[0]->cat_name).'</a>';
         ?></a>
        &gt;
        <a style="color: #999;" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </div>
    <header class="entry-header" >

            <?php everbox_post_category(); ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
            <div class="the-targs">
            <?php 
                $terms = get_the_terms( get_the_ID(), 'post_tag' );
                if(is_array($terms)){
                    foreach ($terms as $val){
                        echo '<a class="the-targ-a" href="'.get_term_link( $val, 'post_tag' ).'"><i class="icon list-alt"></i>'.$val->name.'</a>';
                    }
                }
            ?>
            </div>
            <?php everbox_post_meta(); ?>
    </header>
    <main id="main" class="site-main" role="main" style="margin: 12px;">
		<article id="post-<?php the_ID(); ?>" <?php post_class('single-post'); ?>>
			
			<!-- END .entry-header -->
			<div class="entry-content">
                                <?php if(has_post_thumbnail()) : ?>
                            <!--iv class="entry-thumbnail" style="text-align: center;">
					<?php the_post_thumbnail(); ?>
				</div-->
				<!-- END .entry-thumbnail -->
                                <?php endif; ?>
				<?php the_content(); ?>
				<?php
					wp_link_pages( array(
						'before' => '<div class="pagination-wrap"><div class="link-pages">',
						'after'  => '</div></div>',
						'pagelink' => '<span>%</span>'
					) );
				?>
			</div>
			<!-- END .entry-content -->
			<footer class="entry-footer">
				<?php //everbox_post_tags(); ?>
			</footer>
			<!-- END .entry-footer -->
		</article>
		<!-- END .single-post -->
		

		<?php
			// If comments are open or we have at least one comment, load up the comment template
			if ( comments_open() || get_comments_number() ) :
				comments_template();
			endif;
		?>
	</main>
    <div class="single-footer-cates">
        <span>浏览相关类别的文章:
        <?php
                        foreach ($category as $kk=>$val){
                            echo '<a style="background-color:'.$colors_arr[mt_rand(0,9)].';" href="'.esc_url(get_category_link( $val->term_id )).'" title="' . 
                                esc_attr( sprintf( __( "View all posts in %s", 'everbox' ), $val->name ) ) .
                                '">'.esc_html($val->cat_name).'</a>';
                        }
        ?>
        </span>
    </div>
    <?php
        get_content_relation_cates();
    ?>
    
        <?php everbox_post_navigation(); ?>
	<!-- END .site-main -->
</div>
<!-- END #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
